//==============================================================================
#include "CApp.h"

//==============================================================================
void CApp::OnCleanup() {
	CArea::AreaControl.OnCleanup();

    //--------------------------------------------------------------------------
    // Entities
    //--------------------------------------------------------------------------
  /*  for(int i = 0;i < CEntity::EntityList.size();i++) {
        if(!CEntity::EntityList[i]) continue;

        CEntity::EntityList[i]->OnCleanup();
    }

    CEntity::EntityList.clear();
*/
 for(int i = 0;i < CObjetoAnimado::ObjectList.size();i++) {
        if(!CObjetoAnimado::ObjectList[i]) continue;

        CObjetoAnimado::ObjectList[i]->OnCleanup();
        if ( CObjetoAnimado::ObjectList[i]->Type == ENTITY_TYPE_BALA ||
             CObjetoAnimado::ObjectList[i]->Type == ENTITY_TYPE_BOMBA ||
             CObjetoAnimado::ObjectList[i]->Type == ENTITY_TYPE_EXPLOSION ||
             CObjetoAnimado::ObjectList[i]->Type == ENTITY_TYPE_PLANTA
             )
            delete CObjetoAnimado::ObjectList[i];
    }

    CObjetoAnimado::ObjectList.clear();
    SDL_FreeSurface(Surf_Display);
    SDL_Quit();
}

//==============================================================================
